package com.artezio.buyndrive.domain;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;



@Entity
@Table(name = "parts")
//Запчасти
public class Parts implements Serializable {
    private static final long serialVersionUID = 1L;

    //Название запчасти
    @Size(max = 300)
    @Column(name = "name")
    private String name;
    
    //Описание
    @Size(max = 300)
    @Column(name = "description")
    private String description;
    
    //Номер по каталогу
    @Size(max = 50)
    @Column(name = "catalog_number")
    private String catalogNumber;
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;
    
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "parts")
    private Collection<CarserviceParts> carservicePartsCollection;
    
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "parts")
    private Collection<ApplicabilityParts> applicabilityPartsCollection;

    public Parts() {
    }

    public Parts(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getCatalogNumber() {
        return catalogNumber;
    }

    public void setCatalogNumber(String catalogNumber) {
        this.catalogNumber = catalogNumber;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Collection<CarserviceParts> getCarservicePartsCollection() {
        return carservicePartsCollection;
    }

    public void setCarservicePartsCollection(Collection<CarserviceParts> carservicePartsCollection) {
        this.carservicePartsCollection = carservicePartsCollection;
    }

    public Collection<ApplicabilityParts> getApplicabilityPartsCollection() {
        return applicabilityPartsCollection;
    }

    public void setApplicabilityPartsCollection(Collection<ApplicabilityParts> applicabilityPartsCollection) {
        this.applicabilityPartsCollection = applicabilityPartsCollection;
    }

    
}
